home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
vidlibp
/
vidgrid.frm
< prev
next >
Wrap
Text File
|
1995-05-01
|
10KB
|
323 lines
VERSION 2.00
Begin Form VidGrid
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Caption = "Find Video Record"
ClientHeight = 5550
ClientLeft = 90
ClientTop = 1545
ClientWidth = 9435
Height = 5955
HelpContextID = 235
Left = 30
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5550
ScaleWidth = 9435
Top = 1200
Width = 9555
WindowState = 2 'Maximized
Begin TextBox txtTape
DataField = "RecCode"
DataSource = "dtaVideo"
Height = 615
Left = 8595
TabIndex = 9
TabStop = 0 'False
Top = 3975
Visible = 0 'False
Width = 645
End
Begin TextBox txtTime
DataField = "RunTime"
DataSource = "dtaVideo"
Height = 615
Left = 8595
TabIndex = 8
TabStop = 0 'False
Top = 3225
Visible = 0 'False
Width = 645
End
Begin TextBox txtYear
DataField = "RlsYear"
DataSource = "dtaVideo"
Height = 615
Left = 8595
TabIndex = 7
TabStop = 0 'False
Text = " "
Top = 2475
Visible = 0 'False
Width = 645
End
Begin CommandButton cmdPageForward
Caption = ">"
Height = 270
Left = 6705
TabIndex = 5
Top = 375
Width = 285
End
Begin CommandButton cmdPageBack
Caption = "<"
Height = 270
Left = 1215
TabIndex = 6
Top = 375
Width = 285
End
Begin TextBox txtName
DataField = "VidName"
DataSource = "dtaVideo"
Height = 615
Left = 8595
TabIndex = 4
TabStop = 0 'False
Top = 1725
Visible = 0 'False
Width = 645
End
Begin TextBox txtCode
DataField = "VidCode"
DataSource = "dtaVideo"
Height = 615
Left = 8595
TabIndex = 3
TabStop = 0 'False
Top = 975
Visible = 0 'False
Width = 645
End
Begin Data dtaVideo
Connect = ""
DatabaseName = "VIDLIB.MDB"
Exclusive = 0 'False
Height = 270
Left = 1485
Options = 0
ReadOnly = -1 'True
RecordSource = "Video"
Top = 375
Width = 5235
End
Begin CommandButton cmdDone
Caption = "&Done"
Height = 465
HelpContextID = 235
Left = 8235
TabIndex = 0
Top = 150
Width = 1185
End
Begin Grid grdVideo
BackColor = &H00FFFF00&
Cols = 5
FixedCols = 0
Height = 6090
HelpContextID = 235
HighLight = 0 'False
Left = 180
TabIndex = 1
Top = 825
Width = 9255
End
Begin Label lblData
BackColor = &H00FFFF00&
BorderStyle = 1 'Fixed Single
Height = 240
Left = 1215
TabIndex = 2
Top = 150
Width = 5775
End
End
' Subsystem: Edit
' Module: VidGrid.Frm
' Date: 01/02/94
' Author: Richard Stauch
' Notes:
' This form displays up to MAXROW rows of data from the Video
' table. The user can scroll through the data, and can select
' a row making it the current record. The current record is
' always displayed in the top row.
' The module-level variables RepoFlag, DataMove and GridFill
' work together to prevent recursion into the FillGrid procedure
' when moving through the data normally, or when a record is
' read paging up or down.
Option Explicit
DefInt A-Z
' Constants
Const MAXROW = 24 ' The Maximum data rows.
' Variables
Dim RepoFlag As Integer ' Reposition flag.
Dim DataMove As Integer ' Data Move flag.
Dim GridFill As Integer ' Grid Fill flag.
Sub cmdDone_Click ()
' Remove the grid form, and return to the calling form.
Unload VidGrid
End Sub
Sub cmdPageBack_Click ()
' Perform the MovePrevious method up to MAXROWs.
Dim I As Integer ' Counter to read MAXROWs.
' Prevent the system from filling the grid until we're done.
GridFill% = True
RepoFlag% = True
' Read backward until we reach MAXROW, or beginning-of-file.
Do Until dtaVideo.Recordset.BOF Or I% = MAXROW
' Capture the current record code before moving.
CurrentRecordCode$ = txtCode.Text
dtaVideo.Recordset.MovePrevious
I% = I% + 1
Loop
' We have the code, now fill the grid.
GridFill% = False
RepoFlag% = False
dtaVideo.Recordset.FindFirst "VidCode = '" + CurrentRecordCode$ + "'"
End Sub
Sub cmdPageForward_Click ()
' Perform the MoveNext method up to MAXROWs.
Dim I As Integer ' Counter to read MAXROWS.
' Prevent the system from filling the grid until we're done.
GridFill% = True
RepoFlag% = True
' Read forward until we reach MAXROW, or end-of-file.
Do Until dtaVideo.Recordset.EOF Or I% = MAXROW
' Capture the current record before moving.
CurrentRecordCode$ = txtCode.Text
dtaVideo.Recordset.MoveNext
I% = I% + 1
Loop
' We have the code, now fill the grid.
GridFill% = False
RepoFlag% = False
dtaVideo.Recordset.FindFirst "VidCode = '" + CurrentRecordCode$ + "'"
End Sub
Sub dtaVideo_Reposition ()
' Data control has repositioned.
If DataMove% = True And GridFill% = False Then
' The user has clicked the data control, or we're paging.
CurrentRecordCode$ = txtCode.Text
DataMove% = False
End If
If RepoFlag% = False Then
' Don't call FillGrid recursively.
RepoFlag% = True
FillGrid
RepoFlag% = False
End If
End Sub
Sub dtaVideo_Validate (Action As Integer, Save As Integer)
' Data control Validate event.
Select Case Action
Case DATA_ACTIONUNLOAD
' The user clicked the Done command button.
CurrentRecordCode$ = txtCode.Text
Case DATA_ACTIONMOVEFIRST, DATA_ACTIONMOVEPREVIOUS, DATA_ACTIONMOVENEXT, DATA_ACTIONMOVELAST
' We're moving the record pointer.
DataMove% = True
End Select
End Sub
Sub FillGrid ()
' Fill the grid control starting with the current record.
Dim I As Integer
' Prevent the Reposition event from calling this procedure.
GridFill% = True
' Maximize the grid rows.
grdVideo.Rows = MAXROW + 1
' Begin with the current record.
dtaVideo.Recordset.FindFirst "VidCode = '" + CurrentRecordCode$ + "'"
' Point to the first column.
grdVideo.Col = 0
' Point to the first row.
I% = 0
Do Until dtaVideo.Recordset.EOF Or I% = MAXROW
I% = I% + 1 ' Increment the row counter.
grdVideo.Row = I% ' Point to the current row.
' Now set the text of each cell with the bound control texts.
grdVideo.Text = txtCode.Text
grdVideo.Col = 1
grdVideo.Text = txtName.Text
grdVideo.Col = 2
grdVideo.Text = txtYear.Text
grdVideo.Col = 3
grdVideo.Text = txtTime.Text
grdVideo.Col = 4
grdVideo.Text = txtTape.Text
grdVideo.Col = 0 ' Reset the column.
dtaVideo.Recordset.MoveNext ' Read the next record.
Loop
' Make sure there are no blank rows.
If I% < MAXROW Then
grdVideo.Rows = I% + 1
End If
' Reset the current record.
dta